<template>
	<view>
		<view class="detailedBox" v-for="(ele,ind) in operationRecordList" :key="ind">
			<view class="detailedBoxItem">
				<view>
					<view>账户类型</view>
					<view>
						{{ele.accountName}}
					</view>
				</view>
				<view>
					<view>操作类型</view>
					<view>
						{{ele.optName}}
					</view>
				</view>
				<view>
					<view>操作日期</view>
					<view>{{ele.optTime}}</view>
				</view>
				<view>
					<view>金额</view>
					<view>￥{{ele.optAmount}}</view>
				</view>
				<view>
					<view>余额</view>
					<view>￥{{ele.afterOptAmount}}</view>
				</view>
				<view>
					<view>凭证号</view>
					<view>{{ele.serialCode}}</view>
				</view>
				<view>
					<view>备注</view>
					<view>{{ele.memo}}</view>
				</view>
			</view>		
		</view>
	</view>
</template>

<script>
	import {
		getOperationRecordData
	} from '@/api/directSelling.js';
	export default {
		data() {
			return {
				operationRecordList:[],
				pageNumber:1,
				isSrcllButton:false
			}
		},
		created() {
			this.getOperationRecordData()
		},
		onReachBottom() {
			if(this.isSrcllButton){
				this.getOperationRecordData();
			}
		},
		methods: {
			//判断当前页码与接口中总页码进行对比，查看是否可以进行滑动操作
			getOperationRecordData(){
				getOperationRecordData(
				{
					pageSize: 10,
					pageNumber: this.pageNumber
				}
				).then((res)=>{
					let data=res.data.rows;
					if(this.pageNumber<=res.data.pages){
						this.isSrcllButton=true;
						this.pageNumber=this.pageNumber+1;
					}else{
						this.isSrcllButton=false;
					}
					if(this.isSrcllButton){
						this.operationRecordList=this.operationRecordList.concat(data);
					}
				}).catch((err)=>{
					
				})
			}
		}
	}
</script>

<style lang="scss">
	body,
	page {
		background: #fff;
		padding: 20rpx 30rpx!important;
		box-sizing: border-box;
	}

	.detailedBox {
		width: 100%;
		height: auto;
		padding: 20rpx 30rpx;
		box-sizing: border-box;
		box-shadow: 0px 0px 10px #e6e6e6;
		border-radius: 21rpx;
		margin-bottom:40rpx;
		.detailedTotal {
			text-align: center;
			.amount {
				font-size: 56rpx;
				font-weight: bold;
				margin-top: 25rpx;
				margin-bottom: 20rpx;
			}
		}

		>view.detailedBoxItem>view {
			display: flex;
			justify-content: space-between;
			line-height: 45rpx;
			font-size: 30rpx;
			margin-top: 25rpx;
		}
	}
	.keepBnt {
		width: 690rpx;
		height: 86rpx;
		border-radius: 50rpx;
		text-align: center;
		line-height: 86rpx;
		margin: 50rpx auto;
		font-size: 32rpx;
		color: #fff;
	}
</style>
